#ifndef _RETRO_RESOURCEEDITOR
#define _RETRO_RESOURCEEDITOR

namespace Retro
{
  namespace Creator
  {
    namespace Editor
    {
      enum EditorItem
      {
        EditorItemZoom      = 0x0001,
        EditorItemUser,
      };

      enum EditorNotify
      {
        EditorNotifyUndo    = 0x0001,
        EditorNotifyRedo,
        EditorNotifyCancel,
        EditorNotifyEdit,
        EditorNotifyCopy,
        EditorNotifySelect,
        EditorNotifyZoom,
        EditorNotifyUser,
      };

      enum EditorWindow
      {
        EditorWindowToolbar = 0x0100,
      };

      class EditorBase : public GUI::Component
      {
      private:
        ToolBar*            mToolBar;
        Data::ResourceType  mType;
        Menu                mMenuZoom;
        Data::Resource*     mResource;

      protected:
        virtual VOID        onNotify(Event::NotifyEvent& iEvent);

        virtual VOID        clearUndo()   = 0;
        virtual VOID        onToolbar(ToolBarNotify* iData) = 0;

        INL Menu&           getMenuZoom()
        {
          return mMenuZoom;
        }

      public:
        virtual VOID        initToolbar();

        INL Data::ResourceType getType()
        {
          return mType;
        }

        INL Data::Resource* getResource()
        {
          return mResource;
        }
        virtual VOID        setResource(Data::Resource* iValue);

        virtual INT         getZoom() = 0;
        virtual VOID        setZoom(INT value);

        INL ToolBar*        getToolBar()
        {
          return mToolBar;
        }
        INL VOID            setToolBar(ToolBar* iValue)
        {
          mToolBar = iValue;
          if (mToolBar)
          {
            mToolBar->setNotifyWindow(*this);
            mToolBar->setID(EditorWindowToolbar);
          }
        }

        virtual INT         getLineSize() = 0;

        virtual BOOL        canUndo() = 0;
        virtual BOOL        canRedo() = 0;
        virtual BOOL        undo() = 0;
        virtual BOOL        redo() = 0;
        virtual VOID        flush(Data::Resource* oResource) = 0;
        virtual BOOL        save(HANDLE iFile) = 0;

        EditorBase(Data::ResourceType iType);
        virtual ~EditorBase();
      };
    } // namespace Editor
  } // namespace Creator
} // namespace Retro

#endif
